From ccfe86729e3a454e3fdf529abd7063ceb8fa859f Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Sun, 24 Jul 2022 16:45:29 +0200
Subject: add bot detail page

---
 web/pw-server/src/routes/bots/[bot_id].svelte | 74 ---------------------------
 1 file changed, 74 deletions(-)
 delete mode 100644 web/pw-server/src/routes/bots/[bot_id].svelte

(limited to 'web/pw-server/src/routes/bots/[bot_id].svelte')

diff --git a/web/pw-server/src/routes/bots/[bot_id].svelte b/web/pw-server/src/routes/bots/[bot_id].svelte
deleted file mode 100644
index 3eece10..0000000
--- a/web/pw-server/src/routes/bots/[bot_id].svelte
+++ /dev/null
@@ -1,74 +0,0 @@
-<script lang="ts" context="module">
-  import { get_session_token } from "$lib/auth";
-
-  export async function load({ page }) {
-    const token = get_session_token();
-    const res = await fetch(`/api/bots/${page.params["bot_id"]}`, {
-      headers: {
-        "Content-Type": "application/json",
-        Authorization: `Bearer ${token}`,
-      },
-    });
-
-    if (res.ok) {
-      const data = await res.json();
-      return {
-        props: {
-          bot: data["bot"],
-          bundles: data["bundles"],
-        },
-      };
-    }
-
-    return {
-      status: res.status,
-      error: new Error("Could not load bot"),
-    };
-  }
-</script>
-
-<script lang="ts">
-  import dayjs from "dayjs";
-
-  export let bot: object;
-  export let bundles: object[];
-
-  let files;
-
-  async function submitCode() {
-    console.log("click");
-    const token = get_session_token();
-
-    const formData = new FormData();
-    formData.append("File", files[0]);
-
-    const res = await fetch(`/api/bots/${bot["id"]}/upload`, {
-      method: "POST",
-      headers: {
-        // the content type header will be set by the browser
-        Authorization: `Bearer ${token}`,
-      },
-      body: formData,
-    });
-
-    console.log(res.statusText);
-  }
-</script>
-
-<div>
-  {bot["name"]}
-</div>
-
-<div>Upload code</div>
-<form on:submit|preventDefault={submitCode}>
-  <input type="file" bind:files />
-  <button type="submit">Submit</button>
-</form>
-
-<ul>
-  {#each bundles as bundle}
-    <li>
-      bundle created at {dayjs(bundle["created_at"]).format("YYYY-MM-DD HH:mm")}
-    </li>
-  {/each}
-</ul>
-- 
cgit v1.2.3

